//
//  WHNCollectionViewCell.m
//  城市
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 Hner. All rights reserved.
//

#import "WHNCollectionViewCell.h"

@implementation WHNCollectionViewCell

#pragma mark 懒加载
-(UIImageView *)mainImageView
{
    if (!_mainImageView) {
        _mainImageView = [[UIImageView alloc]init];
        [self addSubview:_mainImageView];
    }
    return _mainImageView;
}
-(UIImageView *)rightImageView
{
    if (!_rightImageView) {
        _rightImageView = [[UIImageView alloc]init];
        [self addSubview:_rightImageView];
    }
    return _rightImageView;
}
-(UIImageView *)iconImageView1
{
    if (!_iconImageView1) {
        _iconImageView1 = [[UIImageView alloc]init];
        [self addSubview:_iconImageView1];
    }
    return _iconImageView1;
}
-(UIImageView *)iconImageView2
{
    if (!_iconImageView2) {
        _iconImageView2 = [[UIImageView alloc]init];
        [self addSubview:_iconImageView2];
    }
    return _iconImageView2;
}
-(UIImageView *)iconImageView3
{
    if (!_iconImageView3) {
        _iconImageView3 = [[UIImageView alloc]init];
        [self addSubview:_iconImageView3];
    }
    return _iconImageView3;
}
-(UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        [_titleLabel NightWithType:UIViewColorTypeNormal];
        [self addSubview:_titleLabel];
    }
    return _titleLabel;
}
-(UILabel *)longLabel
{
    if (!_longLabel) {
        _longLabel = [[UILabel alloc]init];
        [_longLabel NightWithType:UIViewColorTypeNormal];
        [self addSubview:_longLabel];
    }
    return _longLabel;
}
-(UILabel *)byLabel
{
    if (!_byLabel) {
        _byLabel = [[UILabel alloc]init];
        [_byLabel NightWithType:UIViewColorTypeNormal];
        [self addSubview:_byLabel];
    }
    return _byLabel;
}
-(UILabel *)numLabel
{
    if (!_numLabel) {
        _numLabel = [[UILabel alloc] init];
        [_numLabel NightWithType:UIViewColorTypeNormal];
        [self addSubview:_numLabel];
    }
    return _numLabel;
}



-(void)setKind:(WHNCollectionViewKind)kind
{
    if (_kind != kind) {
        _kind = kind;
    }
    switch (kind) {
        case WHNCollectionViewKindOneLabel://城市
            self.titleLabel.frame = self.contentView.frame;
            
            break;
        case WHNCollectionViewKindOnePicture://榜单第一个cell
            self.mainImageView.frame = self.frame;
            
            break;

        case WHNCollectionViewKindOneLabelAndOnePicture://本地台,推荐电台
            self.iconImageView1.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
            self.mainImageView.frame = CGRectMake(2 * FitWidth, 2 * FitHeight, self.frame.size.width - 4 * FitWidth, self.frame.size.width - 4 * FitHeight);
            self.titleLabel.frame = CGRectMake(self.mainImageView.frame.origin.x, self.mainImageView.frame.origin.y + self.mainImageView.frame.size.height + 5 * FitHeight, self.mainImageView.frame.size.width, 20 * FitHeight);
            self.titleLabel.textAlignment = 1;
            
            break;
        case WHNCollectionViewKindThreeLabelAndTwoPicture://节目榜单
            self.mainImageView.frame = CGRectMake(10 * FitWidth, 10 * FitHeight, 80 * FitHeight, 80 * FitHeight);
            self.titleLabel.frame = CGRectMake(_mainImageView.frame.origin.x + _mainImageView.frame.size.width + 10 * FitWidth, _mainImageView.frame.origin.y, self.frame.size.width - _mainImageView.frame.size.width - 60 * FitWidth, 30 * FitHeight);
            self.byLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + 5 * FitHeight, _titleLabel.frame.size.width, 20 * FitHeight);
            self.longLabel.frame = CGRectMake(_byLabel.frame.origin.x, _byLabel.frame.origin.y + _byLabel.frame.size.height, _byLabel.frame.size.width, _byLabel.frame.size.height);
            self.rightImageView.frame = CGRectMake(_byLabel.frame.origin.x + _byLabel.frame.size.width + 10 * FitWidth, _byLabel.frame.origin.y, 20 * FitHeight, 20 * FitHeight);
            self.iconImageView1.frame = CGRectMake(_longLabel.frame.origin.x, _longLabel.frame.origin.y + _longLabel.frame.size.height + 10 * FitHeight, self.frame.size.width - _mainImageView.frame.size.width - 20 * FitWidth, 1 * FitHeight);
            _iconImageView1.backgroundColor = [UIColor lightGrayColor];
            break;
        case WHNCollectionViewKindThreeLabelAndThreePicture://排行榜
            
            self.mainImageView.frame = CGRectMake(10 * FitWidth, 10 * FitHeight, 80 * FitHeight, 80 * FitHeight);
            self.titleLabel.frame = CGRectMake(_mainImageView.frame.origin.x + _mainImageView.frame.size.width + 10 * FitWidth, _mainImageView.frame.origin.y, self.frame.size.width - _mainImageView.frame.size.width - 60 * FitWidth, 30 * FitHeight);
            self.byLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height, _titleLabel.frame.size.width, 20 * FitHeight);
            self.iconImageView1.frame = CGRectMake(_byLabel.frame.origin.x, _byLabel.frame.origin.y + _byLabel.frame.size.height, 20 * FitHeight, 20 * FitHeight);
            self.numLabel.frame = CGRectMake(_iconImageView1.frame.origin.x + _iconImageView1.frame.size.width, _iconImageView1.frame.origin.y, _byLabel.frame.size.width - _iconImageView1.frame.size.width, _iconImageView1.frame.size.height);
            self.rightImageView.frame = CGRectMake(_byLabel.frame.origin.x + _byLabel.frame.size.width + 10 * FitWidth, _byLabel.frame.origin.y, 20 * FitHeight, 20 * FitHeight);
            self.iconImageView2.frame = CGRectMake(_iconImageView1.frame.origin.x, _iconImageView1.frame.origin.y + _iconImageView1.frame.size.height + 10 * FitHeight, self.frame.size.width - _mainImageView.frame.size.width - 20 * FitWidth, 1 * FitHeight);
            _iconImageView2.backgroundColor = [UIColor lightGrayColor];
            
            break;

        default:
            break;
    }
}
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self NightWithType:UIViewColorTypeNormal];
    }
    return self;
}








@end
